<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

	<xsl:output method='html' version='1.0' encoding='UTF-8' indent='yes'/>	
	
	<!-- xml filesources -->
	<xsl:variable name="src_head" select="document('../xml/templates/head.xml')"/>
	<xsl:variable name="src_head_ie" select="document('../xml/templates/head_ie.xml')"/>
	<xsl:variable name="src_header" select="document('../xml/templates/header.xml')"/>
	<xsl:variable name="src_nav" select="document('../xml/templates/navbar.xml')"/>
	<xsl:variable name="src_footer" select="document('../xml/templates/footer_old.xml')"/>

	<!-- template to load a static content -->
	<xsl:template name="Loader">
		<xsl:param name="src"/>
		<xsl:copy-of select="$src/root/*[name() != 'namespace']"/>
	</xsl:template>

	<xsl:template name="navLoader">
		<xsl:param name="src"/>
		<xsl:copy-of select="$src/root/linkable/*[name() != 'namespace']"/>
	</xsl:template>	
	
	<!-- template to load IE Fix content -->
	<xsl:template name="IELoader">
		<xsl:param name="src"/>
		<xsl:comment>[if IE 6]><xsl:value-of select="$src"/>&lt;![endif]</xsl:comment>
	</xsl:template>

	<xsl:template match="/">
		<html>
			<head>
				<!-- load common code -->
				<xsl:call-template name="Loader">
					<xsl:with-param name="src" select="$src_head"/>
				</xsl:call-template>
				<link rel="stylesheet" href="../css/index.css" type="text/css" />
				<link rel="stylesheet" href="../css/feedindex.css" type="text/css" />
				<!-- load ie fix -->
				<xsl:call-template name="IELoader">
					<xsl:with-param name="src" select="$src_head_ie/root/common"/>
				</xsl:call-template>				
			</head>

			<body>

				<!-- load common code -->
				<xsl:call-template name="Loader">
					<xsl:with-param name="src" select="$src_header"/>
				</xsl:call-template>				
				
				<!-- navbar -->
				<div id="navbar">				
				<xsl:call-template name="navLoader">
					<xsl:with-param name="src" select="$src_nav"/>
				</xsl:call-template>				
				</div>
				
				<div id="feed_result">
			
					<h1>MyFeed community submissions</h1>
    
					<div class="access_help">
					<a href="#most_popular_feed">Jump to most popular feeds in this page</a> | 
					<a href="#most_recent_feed">Jump to most recent feeds in this page</a> | 
					<a href="#header">Jump to top in this page</a>
					</div>
    
					<xsl:for-each select="feedindex/most">
						<div>
							<xsl:attribute name="id">
							<xsl:value-of select="@id"/>
							</xsl:attribute>
								<h2><a><xsl:attribute name="name"><xsl:value-of select ="@id"/></xsl:attribute></a>
								<xsl:value-of select ="@label"/></h2>
								<ol class="feed_post_list_index">
									<xsl:for-each select="feed">
									<li>
										<h4><xsl:value-of select="name"/></h4>
										<p>With <xsl:value-of select = "last"/> Subscribers</p>
											<a>
												<xsl:attribute name="href">
													<xsl:value-of select = "link"/>
												</xsl:attribute>
												Visit original feed
											</a>
									</li>			
									</xsl:for-each>
								</ol>
							<div class="access_help">
							<a href="#feed_result">Jump to community submissions in this page</a>
							</div>
						</div>	
					</xsl:for-each>	
				</div>

				<!-- footer -->
				<xsl:call-template name="Loader">
					<xsl:with-param name="src" select="$src_footer"/>
				</xsl:call-template>
				
				<div class="access_help">
				<a href="#header">Jump to top in this page</a>
				</div>
			</body>
		</html>
	</xsl:template>
</xsl:stylesheet>
